Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: set the mode directly in the client #287

Merged
merged 8 commits into from
Sep 21, 2022
Merged

Conversation

Esadruhn
Copy link
Contributor

@Esadruhn Esadruhn commented Sep 19, 2022

Companion PRs

#287
Substra/substrafl#19
Substra/substra-tests#210
Substra/substra-documentation#178

Context and user need

In local mode, we can choose between docker model and subprocess mode. This choice is done by the user by specifying an environment variable.
Specifying an environment variable can be difficult and annoying for the user, especially for user without a lof of experience with the terminal.

Functional spec

Specify the local mode with: Client(mode=["REMOTE", "LOCAL_DOCKER", "LOCAL_SUBPROCESS"])
default value: remote

Technical spec:

right now there is a variable env, change how it is passed
use an enum

update the tests:
substra
connectlib
connect-tests
update the examples:
connect-documentation
update the CI

Tests: parametrize the spawner type as a fixture
Update the makefile:
have test fast and slow
keep the same general commands (ie be able to launch the PR tests, the tests on main, and additional commands to keep the dev easy (eg run only fast subprocess test))

Acceptance criteria:

User can specify the local mode to use without having to use environment variables

Notes

Please check if the PR fulfills these requirements

  • If necessary, the changelog has been updated
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • The commit message follows the conventional commit specification
  • For any breaking changes, companion PRs have been opened on the following repositories:

Signed-off-by: thaisdeboisfosse <thais.de-boisfosse@owkin.com>
Signed-off-by: thaisdeboisfosse <thais.de-boisfosse@owkin.com>
Signed-off-by: thaisdeboisfosse <thais.de-boisfosse@owkin.com>
Signed-off-by: thaisdeboisfosse <thais.de-boisfosse@owkin.com>
Signed-off-by: thaisdeboisfosse <thais.de-boisfosse@owkin.com>
Signed-off-by: thaisdeboisfosse <thais.de-boisfosse@owkin.com>
Signed-off-by: thaisdeboisfosse <thais.de-boisfosse@owkin.com>
Signed-off-by: thaisdeboisfosse <thais.de-boisfosse@owkin.com>
@Esadruhn
Copy link
Contributor Author

/e2e --refs substrafl=local_mode_client,substra-tests=local_mode_client --mode standalone --tests sdk,substrafl

@Owlfred
Copy link

Owlfred commented Sep 20, 2022

End to end tests: ❌ FAILURE

Jobs status:

Darn it.

@Esadruhn
Copy link
Contributor Author

The error is

        except requests.exceptions.ConnectionError as e:
>           raise exceptions.ConnectionError.from_request_exception(e)
E           substra.sdk.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

@Esadruhn
Copy link
Contributor Author

/e2e --refs substrafl=local_mode_client,substra-tests=local_mode_client --mode standalone --tests sdk,substrafl

@Owlfred
Copy link

Owlfred commented Sep 21, 2022

End to end tests: ❌ FAILURE

Jobs status:

Not this time.

@Esadruhn
Copy link
Contributor Author

fixed the substra tests

@Esadruhn
Copy link
Contributor Author

/e2e --refs substrafl=local_mode_client,substra-tests=local_mode_client --mode standalone --tests sdk,substrafl

@Owlfred
Copy link

Owlfred commented Sep 21, 2022

End to end tests: ✔️ SUCCESS

Awesome sauce!

Copy link
Contributor

@louishulot louishulot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super small changes, otherwise, LGTM

if debug:
# Hybrid mode: the local backend also connects to
# a remote backend in read-only mode.
if backend_type in [schemas.BackendType.LOCAL_DOCKER, schemas.BackendType.LOCAL_SUBPROCESS]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if backend_type in [schemas.BackendType.LOCAL_DOCKER, schemas.BackendType.LOCAL_SUBPROCESS]:
elif backend_type in [schemas.BackendType.LOCAL_DOCKER, schemas.BackendType.LOCAL_SUBPROCESS]:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not need a elif since there is a return statement in the if above

@Esadruhn Esadruhn merged commit 09aed6e into main Sep 21, 2022
@Esadruhn Esadruhn deleted the local_mode_client branch September 21, 2022 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants